package cn.edu.gdu.quizpractice.service.impl;

import cn.edu.gdu.quizpractice.dao.CategoryDao;
import cn.edu.gdu.quizpractice.entity.Bank;
import cn.edu.gdu.quizpractice.entity.Category;
import cn.edu.gdu.quizpractice.service.ICategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Aubery
 * @Date: 2025-02-25-22:19
 * @Description:
 */
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> implements ICategoryService {

    @Autowired
    private CategoryDao categoryDao;

    @Override
    public Category findByName(String name) {
        return categoryDao.findByName(name);
    }


    @Override
    public List<Category> findAll() {
        return categoryDao.findAll();
    }

    @Override
    public boolean insertCategory(Category category) {
        return categoryDao.insertCategory(category);
    }

    @Override
    public boolean deleteByName(String name) {
        return categoryDao.deleteByName(name);
    }

    @Override
    public boolean addCateory(String categoryName) {
        return categoryDao.addCateory(categoryName);
    }

    @Override
    public int updateCategory(Category category) {
        return categoryDao.updateById(category);
    }

    @Override
    public List<String> findBanksByCategoryName(String categoryName) {
        return categoryDao.findBanksByCategoryName(categoryName);
    }
}
